# This code is part of the MWP System
# Copyright (c) 2012 Benjamin Lubin (blubin@bu.com) 
# Published under and subject to the GPLv2 license available at http://www.gnu.org/licenses/gpl-2.0.html

'''
Created on Dec 18, 2012
@author: blubin
'''

from frontend.roleApplication import RoleApplication;
from frontend.form import Type;
#from unique import UNIQUE;

#        self.register_result_listener("roaster", "request", self.request_complete)
#        self.register_result_listener("roaster", "accept", self.accept_complete)
#        self.register_result_listener("roaster", "roast", self.roast_complete)
#        self.register_result_listener("roaster", "package", self.package_complete)
#        self.register_result_listener("roaster", "alertr", self.alertr_complete) 




class RoasterApplication(RoleApplication):
    """ The Roaster User Interface """

    def __init__(self):
        super(RoasterApplication, self).__init__("CoffeeImport", "roaster");
        self.register_transition_step("request", self.request_form_creator, name_fields=["Type"]);
        self.register_transition_step("accept", self.accept_form_creator, name_fields=["Type"]);
        self.register_transition_step("roast", self.roast_form_creator, name_fields=["Type"]);
        self.register_transition_step("package", self.package_form_creator, name_fields=["Type"]);
        self.register_transition_step("alertr", self.alertr_form_creator, name_fields=["Type"]);

    def request_form_creator(self, stepname, form):
        form.add_field(Type.BOOLEAN, "request", labeltext="Request Sample");

    def accept_form_creator(self, stepname, form):
        form.add_field(Type.BOOLEAN, "accept", labeltext="Accept Sample");
    
    def roast_form_creator(self, stepname, form):
        form.add_field(Type.BOOLEAN, "roast", labeltext="Roasting Complete");
        
    def package_form_creator(self, stepname, form):
        form.add_field(Type.BOOLEAN, "package", labeltext="Packaging Complete");             
        
    def alertr_form_creator(self, stepname, form):
        form.add_field(Type.BOOLEAN, "alertr", labeltext="Send alert to distributor");  
        
        
        
              
        

if __name__ == '__main__':
    app = RoasterApplication();
    app.MainLoop();